<?php

include 'config.php';

$id = $_GET["id"];
$audio = $_GET["audio"];
$video = $_GET["video"];
$total = $_GET["total"];

if (is_numeric($id) && is_numeric($audio) && is_numeric($video) && is_numeric($total)) {
	$query = sprintf("UPDATE uc_images SET rateAudio = %d, rateVideo = %d, rateTotal = %d, viewCount = viewCount + 1 WHERE id = %d", 
	intval($audio),
	intval($video),
	intval($total),
	intval($id));
}


$con = mysql_connect($dbHost,$username,$password);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db($dbName, $con);
$sth = mysql_query($query);
mysql_close($con);

$url = 'Location: http://goodman.se/rateme/get.php?mode='.intval($id);
header( $url ) ;

?>
